<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Programming</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Boost.Sort">
<link rel="up" href="../flat_stable_sort.html" title="2.4.- flat_stable_sort">
<link rel="prev" href="flat_stable_sort_benchmark.html" title="Benchmark">
<link rel="next" href="../linux_single.html" title="2.5.- Linux Benchmarks">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="flat_stable_sort_benchmark.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../flat_stable_sort.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../linux_single.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="sort.single_thread.flat_stable_sort.flat_stable_sort_programming"></a><a class="link" href="flat_stable_sort_programming.html" title="Programming">Programming</a>
</h4></div></div></div>
<div class="blockquote"><blockquote class="blockquote">
<p>
            You only need to include the file boost/sort/sort.hpp.
          </p>
<p>
            The flat_stable_sort function is in the namespace boost::sort.
          </p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">sort</span><span class="special">/</span><span class="identifier">sort</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>


<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">iter_t</span><span class="special">,</span>  <span class="keyword">typename</span> <span class="identifier">compare</span><span class="special">&gt;</span>
<span class="keyword">void</span> <span class="identifier">flat_stable_sort</span> <span class="special">(</span><span class="identifier">iter_t</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">iter_t</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">compare</span> <span class="identifier">comp</span> <span class="special">=</span> <span class="identifier">compare</span><span class="special">());</span>
</pre>
<p>
            This algorithm uses a <span class="bold"><strong>comparison object</strong></span>,
            in the same way as the standard library sort algorithms. If you don't
            define it, the comparison object defaults to std::less, which uses the
            &lt; operator internally for comparisons.
          </p>
<p>
            This algorithm is <span class="bold"><strong>exception safe</strong></span>, meaning
            that, the exceptions generated by the algorithm guarantee the integrity
            of the objects to sort, but not their relative order. If the exception
            is generated inside the objects (in the move or copy constructors) the
            results are undefined.
          </p>
</blockquote></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2014-2017 Steven
      Ross, Francisco Tapia, Orson Peters<p>
        Distributed under the <a href="http://boost.org/LICENSE_1_0.txt" target="_top">Boost
        Software License, Version 1.0</a>.
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="flat_stable_sort_benchmark.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../flat_stable_sort.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../linux_single.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
